class Cartasur::Post < Cartasur::CartasurModel
  attr_accessible :content, :topic_id, :user_id, :reply_post_id

  belongs_to :topic, :class_name => 'Cartasur::Topic'
  belongs_to :user, :class_name => 'Cartasur::User'

  def original_post
    unless self.reply_post_id.nil?
       Cartasur::Post.find(reply_post_id)
    end
  end

  def replies
    Cartasur::Post.where("reply_post_id = #{self.id}")
  end

end
